#!/bin/bash
#
ARCHNAME=`uname -m`
cd ${ARCHNAME}
if rpm -q ft_surface_wrapper &>/dev/null; then
    sudo dnf remove ft_surface_wrapper libglvnd mesa-libgbm \
        mesa-libglapi libglvnd-core-devel mesa-libxatracker mesa-libOSMesa \
        mesa-vdpau-drivers mesa-vulkan-drivers mesa-dri-drivers -y
fi

if [ ${ARCHNAME} == "x86_64" ]; then
sudo dnf install -y harfbuzz-devel fangtian_ipc-1.0-1.x86_64.rpm \
    ft_surface_wrapper-1.0.0-1.x86_64.rpm \
    libglvnd-1.3.4-3.x86_64.rpm \
    libglvnd-core-devel-1.3.4-3.x86_64.rpm \
    libglvnd-devel-1.3.4-3.x86_64.rpm \
    libglvnd-egl-1.3.4-3.x86_64.rpm \
    libglvnd-gles-1.3.4-3.x86_64.rpm \
    libglvnd-glx-1.3.4-3.x86_64.rpm \
    libglvnd-opengl-1.3.4-3.x86_64.rpm \
    mesa-dri-drivers-21.3.1-3.x86_64.rpm \
    mesa-filesystem-21.3.1-3.x86_64.rpm \
    mesa-libEGL-21.3.1-3.x86_64.rpm \
    mesa-libEGL-devel-21.3.1-3.x86_64.rpm \
    mesa-libGL-21.3.1-3.x86_64.rpm \
    mesa-libGL-devel-21.3.1-3.x86_64.rpm \
    mesa-libOSMesa-21.3.1-3.x86_64.rpm \
    mesa-libOSMesa-devel-21.3.1-3.x86_64.rpm \
    mesa-libgbm-21.3.1-3.x86_64.rpm \
    mesa-libgbm-devel-21.3.1-3.x86_64.rpm \
    mesa-libglapi-21.3.1-3.x86_64.rpm \
    mesa-libxatracker-21.3.1-3.x86_64.rpm \
    mesa-libxatracker-devel-21.3.1-3.x86_64.rpm \
    mesa-vdpau-drivers-21.3.1-3.x86_64.rpm \
    mesa-vulkan-devel-21.3.1-3.x86_64.rpm \
    mesa-vulkan-drivers-21.3.1-3.x86_64.rpm
elif [ ${ARCHNAME}  == "aarch64" ]; then
sudo dnf install -y harfbuzz-devel \
    ft_surface_wrapper-1.0.0-1.aarch64.rpm \
    libglvnd-1.3.4-3.aarch64.rpm \
    libglvnd-core-devel-1.3.4-3.aarch64.rpm \
    libglvnd-devel-1.3.4-3.aarch64.rpm \
    libglvnd-egl-1.3.4-3.aarch64.rpm \
    libglvnd-gles-1.3.4-3.aarch64.rpm \
    libglvnd-glx-1.3.4-3.aarch64.rpm \
    libglvnd-opengl-1.3.4-3.aarch64.rpm \
    mesa-dri-drivers-21.3.1-3.aarch64.rpm \
    mesa-filesystem-21.3.1-3.aarch64.rpm \
    mesa-libEGL-21.3.1-3.aarch64.rpm \
    mesa-libEGL-devel-21.3.1-3.aarch64.rpm \
    mesa-libGL-21.3.1-3.aarch64.rpm \
    mesa-libGL-devel-21.3.1-3.aarch64.rpm \
    mesa-libOSMesa-21.3.1-3.aarch64.rpm \
    mesa-libOSMesa-devel-21.3.1-3.aarch64.rpm \
    mesa-libgbm-21.3.1-3.aarch64.rpm \
    mesa-libgbm-devel-21.3.1-3.aarch64.rpm \
    mesa-libglapi-21.3.1-3.aarch64.rpm \
    mesa-libxatracker-21.3.1-3.aarch64.rpm \
    mesa-libxatracker-devel-21.3.1-3.aarch64.rpm \
    mesa-vdpau-drivers-21.3.1-3.aarch64.rpm \
    mesa-vulkan-drivers-21.3.1-3.aarch64.rpm
fi
